package com.hlc.rabbitmq.listener;


import com.alibaba.fastjson.JSON;
import com.hlc.rabbitmq.json.FastJsonMessageConverter;
import com.hlc.rabbitmq.test.User;
import org.apache.log4j.Logger;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.core.MessageListener;

/**
 * Created by Zero on 2017/3/3.
 */
public class PaymentQueueListener implements MessageListener {

    private final Logger logger = Logger.getLogger(PaymentQueueListener.class);

    FastJsonMessageConverter converter = new FastJsonMessageConverter();



    public void onMessage(Message message) {
        logger.info("=======================PaymentQueueListener============================");
        User user = converter.fromMessage(message,User.class);
        System.out.println(JSON.toJSONString(user));
        logger.info("=======================PaymentQueueListener============================");
    }

}
